import { CoolController, BaseController } from '@cool-midway/core';
import { Body, Inject, Post } from '@midwayjs/core';
import { FlockUserEntity } from '../../entity/user';
import { FlockUserService } from '../../service/user';

/**
 * flock模块-用户信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: FlockUserEntity,
  service: FlockUserService,
  pageQueryOp: {
    keyWordLikeFields: ['username'],
    fieldEq: ['status', 'role'],
  }
})
export class AdminFlockUserController extends BaseController {
    @Inject()
    flockUserService: FlockUserService;

    @Post('/getUsersWithLowActivity', { summary: '获取活跃度低于指定值的用户' })
    async getUsersWithLowActivity(@Body('activityThreshold') activityThreshold: number) {
        return this.ok(await this.flockUserService.getUsersWithLowActivity(activityThreshold));
    }
}
